package edu.neelsys.mvc;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import edu.neelsys.business.usercourse.UserCourseBean;
import edu.neelsys.objectmodel.dbentites.UserCourse;

@Controller
@RequestMapping("/home")
public class HomeController {
	@RequestMapping(method = RequestMethod.GET)
	public String setUp(Model model) {

		return "home";
	}

	@Autowired
	UserCourseBean userCourseBean;

	@RequestMapping(value = "/{listUserCourses}",headers="Accept=*/*", method = RequestMethod.GET)
	public @ResponseBody
	List<UserCourse> listUserCourses() {
		List<UserCourse> tmpList = userCourseBean.findCoursesByUser("user1");
		return tmpList;

	}

}
